package com.feicheng.controller.admin;

import com.alibaba.fastjson.JSONObject;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.service.a.FYyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/yyjl")
public class YyController {

    @Autowired
    FYyService fYyService;

    @GetMapping("/page")
    public ResultInfo getByPage(
            @RequestParam(defaultValue = "1") Integer current,
            @RequestParam(defaultValue = "12") Integer size,
            String searchKey
    ){
        JSONObject param = new JSONObject();

        param.put("current", current);
        param.put("size", size);
        param.put("jlname", searchKey);
        param.put("sname", searchKey);
        param.put("ms", searchKey);

        param = fYyService.getYyjlByPage(param);

        return ResultInfo.success(param.get("aroomyyjls"));
    }

    @GetMapping("/info")
    public ResultInfo getInfo(
            String rmorderid){
        System.out.println("info:");
        System.out.println(rmorderid);
        JSONObject param = new JSONObject();

        param.put("rmorderid", rmorderid);

        param = fYyService.getYyjl(param);
        return ResultInfo.success(param);
    }


}


